#include <iostream>
#include <ctime>
using  namespace  std;
const int maxsize= 100;

int a[maxsize];
int n;
int main() {
    cin>>n;
    for(int i=0;i<n;++i)
        cin>>a[i];
    int i=0,j=n-1;
    int p=0;

    while(p<j)
    {
        if(a[p]>0)
        {
            swap(a[i++],a[p]);
        } else if(a[p]<0){
            swap(a[p],a[j--]);
        }
        p++;
    }
    for(int i=0;i<n;++i)
        cout<<a[i]<<" ";
    cout<<endl;

    return 0;
}
